package util;

import pojo.Tgoods;

import java.util.List;

public class Page {
    private int pageNo;
    private int pageSum;
    private int pageSize = 4;
    private int pageCount;

    private List<Tgoods> goods;

    @Override
    public String toString() {
        return "Page{" +
                "pageNo=" + pageNo +
                ", pageSum=" + pageSum +
                ", pageSize=" + pageSize +
                ", pageCount=" + pageCount +
                ", goods=" + goods +
                '}';
    }

    public Page() {
    }

    public Page(int pageNo, int pageSum, int pageSize, int pageCount, List<Tgoods> goods) {
        this.pageNo = pageNo;
        this.pageSum = pageSum;
        this.pageSize = pageSize;
        this.pageCount = pageCount;
        this.goods = goods;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getPageSum() {
        return pageSum;
    }

    public void setPageSum(int pageSum) {
        this.pageSum = pageSum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageSum = pageCount % pageSize == 0 ? pageCount / pageSize : pageCount / pageSize + 1;
        this.pageCount = pageCount;
    }

    public List<Tgoods> getGoods() {
        return goods;
    }

    public void setGoods(List<Tgoods> goods) {
        this.goods = goods;
    }
}
